package com.htht.job.executor;

//import org.mybatis.spring.annotation.MapperScan;
import org.jeesys.common.jpa.dao.GenericDaoImpl;
import org.jeesys.common.jpa.repository.support.GenericJpaRepositoryFactoryBean;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.springframework.context.annotation.ImportResource;
import org.springframework.context.annotation.PropertySource;
import org.springframework.context.annotation.PropertySources;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.data.redis.repository.configuration.EnableRedisRepositories;
import org.springframework.jms.annotation.EnableJms;

import com.htht.job.executor.util.SpringContextUtil;
import org.springframework.transaction.annotation.EnableTransactionManagement;


@SpringBootApplication(scanBasePackages = {"com.htht.job"})
@PropertySources({
	@PropertySource("classpath:jdbc.properties"),
	@PropertySource("classpath:config.properties")

})
@EnableJpaRepositories(basePackages = "com.htht.job.executor.dao", repositoryBaseClass = GenericDaoImpl.class, repositoryFactoryBeanClass = GenericJpaRepositoryFactoryBean.class)
@ImportResource({
	"classpath:dubbo-provider.xml"
})
@EnableTransactionManagement
//@EnableJms
@EnableCaching
//@MapperScan("com.xxl.job.executor.dao")
//@EnableTransactionManagement
@Import(value={SpringContextUtil.class})
public class Application extends SpringBootServletInitializer  {
	public static void main(String[] args) {
		configureApplication(new SpringApplicationBuilder()).run(args);
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return configureApplication(builder);
	}

	private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
		return builder.sources(Application.class);
	}

}